﻿#pragma once
#include "yzrutil.h"
#include "ByteOrder.h"
#include "array/Array.hpp"

namespace yzrilyzr_io{
	EBCLASS(DataInput){
	protected:
	yzrilyzr_array::ByteArray readBuffer;
	bool bigEndian=true;
	public:
	DataInput() :readBuffer(8){}
	void inputOrder(ByteOrder order);
	virtual void readFully(yzrilyzr_array::ByteArray & b);
	virtual void readFully(yzrilyzr_array::ByteArray & arr, u_index off, u_index len)=0;
	virtual u_index skipBytes(u_index n)=0;
	virtual bool readBoolean();
	virtual int8_t readByte();
	virtual uint8_t readUnsignedByte();
	virtual int16_t readShort();
	virtual uint16_t readUnsignedShort();
	virtual int32_t readInt();
	virtual uint32_t readUnsignedInt();
	virtual int64_t readLong();
	virtual uint64_t readUnsignedLong();
	virtual float readFloat();
	virtual double readDouble();
	virtual yzrilyzr_lang::String readUTF();
	};
}